from django.http import HttpResponse
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from netbook.member.member_forms import RegisterForm
from netbook.utils import *

def register(request):
    if request.method == 'POST':
	form = RegisterForm(request.POST)
	if form.is_valid():
	    cd = form.cleaned_data
	    try:
		user = api.register(mail=cd['mail'],passwd=cd['passwd'])
	    except SOAPpy.faultType as ft:
		pass
	    else:
		return HttpResponseRedirect('/auth/login/')
    else:
	form = RegisterForm()
    return render_to_response('register_form.html',{'form':form})

